package com.four.homepage.Task;

import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TaskDao {
    //查
    @Select("SELECT * FROM task")
    List<TaskEntity> selectAllTasks();

    //删
    @Delete("delete from task where id=#{id}")
    public int deleteTaskById(Integer id);

    //增
    @Insert("INSERT INTO task (task) " +
            "VALUES (#{task})")
    int insertTask(TaskEntity taskEntity);

    //限制个数
    @Select("SELECT COUNT(*) FROM task ")
    int countTaskByNumber();

    // 检查任务事项内容是否存在
    @Select("SELECT COUNT(*) FROM task WHERE task = #{task}")
    int countTaskByTask(@Param("task") String task);
}
